package gameStream.state
{
	import flash.display.DisplayObjectContainer;
	import flash.display.Sprite;
	
	import gameStream.display.BallPosition;
	import gameStream.display.BallRenderer;
	import gameStream.stream.BallGO;
	import gameStream.stream.BallGameLoop;
	import gameStream.stream.BallTranslator;
	
	import org.gof.stream.BaseGameObject;
	import org.gof.stream.BaseGameStream;
	import org.gof.stream.IGOInputMeta;
	import org.gof.stream.ISettings;
	
	public class BallGameStream extends BaseGameStream
	{
		// call back for when Ball is clicked.
		public var handleBallClickFunc:Function;
		
		public function BallGameStream(viewPort:DisplayObjectContainer)
		{
			super(viewPort);
			gameState = new BallGameState();
			gameLoop= new BallGameLoop(viewPort, BallRenderer, new BallGameLogic(gameState as BallGameState), new BallTranslator(),gameState);

			var ballSprite:Sprite = new Sprite();
			
			ballSprite.graphics.beginFill(0x809590);
			ballSprite.graphics.drawCircle(0, 0, 35);
			ballSprite.graphics.endFill();
			viewPort.addChild(ballSprite);
			
			var ballGO:BallGO = new BallGO(ballSprite,"ball",new BallPosition(0,0), handleBallGOClick);
			
			addGameObject(ballGO);
		
		}
		
		private function handleBallGOClick():void
		{
			handleBallClickFunc();
		}
			
	}
}